package com.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.sql.Date;
import java.text.SimpleDateFormat;

@TableName("preorder")
public class Preorder {
    private int gId;
    private int tId;

    private int uId;
    private java.sql.Date pDate;
    private int pState;

    public int getgId() {
        return gId;
    }

    public void setgId(int gId) {
        this.gId = gId;
    }

    public int gettId() {
        return tId;
    }

    public void settId(int tId) {
        this.tId = tId;
    }

    public int getuId() {
        return uId;
    }

    public void setuId(int uId) {
        this.uId = uId;
    }

    //    public Date getpDate() {return pDate;}
    public String getpDate() {
        return String.valueOf(pDate);
    }

    public void setpDate(String dateString) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            java.util.Date date = sdf.parse(dateString);
            java.sql.Date sqlDate = new java.sql.Date(date.getTime());
            this.pDate = sqlDate;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
//    public void setpDate(Date pDate) {
//        this.pDate = pDate;
//    }

    public int getpState() {
        return pState;
    }

    public void setpState(int pState) {
        this.pState = pState;
    }

    @Override
    public String toString() {
        return "Preorder{" +
                "g_id=" + gId +
                ", t_id=" + tId +
                ", u_id=" + uId +
                ", p_date=" + pDate +
                ", state=" + pState +
                '}';
    }
}
